package com.cxka.payment.conf;

import com.github.xiaoymin.knife4j.core.util.CommonUtils;
import com.github.xiaoymin.knife4j.spring.annotations.EnableKnife4j;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Profile;
import org.springframework.core.annotation.Order;
import springfox.documentation.builders.ApiInfoBuilder;
import springfox.documentation.builders.ParameterBuilder;
import springfox.documentation.builders.PathSelectors;
import springfox.documentation.builders.RequestHandlerSelectors;
import springfox.documentation.schema.ModelRef;
import springfox.documentation.service.*;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spi.service.contexts.SecurityContext;
import springfox.documentation.spring.web.plugins.Docket;
import springfox.documentation.swagger2.annotations.EnableSwagger2WebMvc;

import java.util.ArrayList;
import java.util.List;

/**
 * @desc: swagger2配置
 */
@Configuration
@EnableKnife4j
@EnableSwagger2WebMvc
public class Swagger2Config {

    /**
     * payment 支付模块
     *
     * @return
     */
    @Bean
    @Order(-1)
    public Docket createManagerApi() {
        return new Docket(DocumentationType.SWAGGER_2)
                .apiInfo(apiInfo())
                .select()
                .apis(RequestHandlerSelectors.basePackage("com.cxka.payment.controller"))
                .paths(PathSelectors.any())
                .build().groupName("创建订单模块");
    }


    private ApiInfo apiInfo() {
        return new ApiInfoBuilder()
                .title("畅想卡API-JAVA示例")
                .description("畅想卡API-JAVA示例")
                .termsOfServiceUrl("http://www.cxka.com")
                .version("version 1.0.1")
                .build();
    }

}